﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinFormStore
{
    public partial class FrmAd : Form
    {
        private List<Image> images;
        private int currentIndex = 0;
        public FrmAd()
        {
            InitializeComponent();
            if (pictureBox1.Image != null)
            {
                linklbl.Enabled = false;
            }
            else
            {
                pictureBox1.Enabled = false;
                linklbl.Enabled = true;
            }  
                images = new List<Image>
                {
                    
                   Properties.Resources._1,
                   Properties.Resources._2,
                   Properties.Resources._3,
                   Properties.Resources._4,
                   Properties.Resources._5,
                   Properties.Resources._6,
                   Properties.Resources._7
                };

            timer1 = new Timer();
            timer1.Interval = 2000; // 设置时间间隔为2秒
            timer1.Tick += timer1_Tick;
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            currentIndex = (currentIndex + 1) % images.Count;
            pictureBox1.Image = images[currentIndex];
        }

        private void FrmAd_FormClosing(object sender, FormClosingEventArgs e)
        {
            timer1.Stop();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            pictureBox1.Controls.Clear();
            //WebBrowser web=new WebBrowser();
            //web.Navigate("https://www.baidu.com");
            
        }
    }
}
